//
// Created by Asus on 2025/6/2.
//

#include <iostream>
#include <vector>
using namespace std;

void printVector(vector<int>& v) {
    for (vector<int>::iterator it = v.begin(); it != v.end(); it++) {
        cout << *it << " ";
    }
    cout << endl;
}

void demo01() {
    vector<int> v = {1, 2, 3, 4, 5,10};
    printVector(v);

    vector<int> v2 = {1, 2, 3, 4, 7};
    printVector(v2);

    v.swap(v2);
    printVector(v);
    printVector(v2);

    vector<int> v3;
    for (int i = 0; i < 10000; i++) {
        v3.push_back(i);
    }
    cout << "v3 capacity: " << v3.capacity() << endl;
    cout << "v3 size: " << v3.size() << endl;

    v.resize(5);
    vector<int>(v).swap(v3);

    cout << "v3 capacity: " << v3.capacity() << endl;
    cout << "v3 size: " << v3.size() << endl;
}


int main(int argc, char *argv[]) {
    demo01();
    return 0;
}
